package observerPattern;

/**
 * Created by JiaJia on 2019/6/16 0016.
 */
public class ConcreteAllyControlCenter extends AllyController {
    public ConcreteAllyControlCenter(String allyName){
        System.out.println(allyName+"战队组建成功！");
        System.out.println("-----------------------");
        this.allyName=allyName;
    }

    @Override
    public void notifyObserver(String name) {
        System.out.println(this.allyName+"紧急通知；盟友"+name+"遭受敌人攻击！");

        for (Object obs:players) {
            if (!((Observer)obs).getName().equalsIgnoreCase(name)){
                ((Observer)obs).help();
            }
        }
    }
}